<?php

use App\Http\Middleware\LoginAuth;
use App\Http\Middleware\LoginAuthH5;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});


Route::prefix('h5')->group(function () {
    Route::prefix('auth')->group(function () {
        Route::post("login",['App\Http\Controllers\H5\AuthController',"login"]);
    });
    Route::middleware([LoginAuthH5::class])->group(function () {
        Route::prefix('mall')->group(function () {
            Route::get("index",['App\Http\Controllers\H5\ProjectMallController',"index"]);
            Route::get("dateDetails",['App\Http\Controllers\H5\ProjectMallController',"dateDetails"]);
            Route::get("countsItems",['App\Http\Controllers\H5\ProjectMallController',"countsItems"]);
            Route::get("malls",['App\Http\Controllers\H5\ProjectMallController',"malls"]);
        });
    });

});


Route::prefix('admin')->group(function () {
    Route::prefix('common')->group(function () {
        Route::post("upload",['App\Http\Controllers\Admin\CommonController',"upload"]);
    });


    Route::prefix('auth')->group(function () {
        Route::post("login",['App\Http\Controllers\Admin\AuthController',"login"]);
    });

    Route::middleware([LoginAuth::class])->group(function () {
        Route::prefix('project')->group(function () {
            Route::post("save",['App\Http\Controllers\Admin\ProjectController',"save"]);
            Route::get("pageItems",['App\Http\Controllers\Admin\ProjectController',"pageItems"]);
            Route::post("updateStatus",['App\Http\Controllers\Admin\ProjectController',"updateStatus"]);
        });

        Route::prefix('capital')->group(function () {
            Route::post("save",['App\Http\Controllers\Admin\CapitalController',"save"]);
            Route::get("pageItems",['App\Http\Controllers\Admin\CapitalController',"pageItems"]);
            Route::post("delete",['App\Http\Controllers\Admin\CapitalController',"delete"]);
        });

        Route::prefix('mall')->group(function () {
            Route::get("malls",['App\Http\Controllers\Admin\MallController',"malls"]);
            Route::get("refreshMall",['App\Http\Controllers\Admin\MallController',"refreshMall"]);
            Route::post("save",['App\Http\Controllers\Admin\MallController',"save"]);
            Route::get("pageItems",['App\Http\Controllers\Admin\MallController',"pageItems"]);
            Route::post("updateStatus",['App\Http\Controllers\Admin\MallController',"updateStatus"]);
            Route::post("delete",['App\Http\Controllers\Admin\MallController',"delete"]);
            Route::get("queryDiffRange",['App\Http\Controllers\Admin\MallController',"queryDiffRange"]);
            Route::post("diffRangeSave",['App\Http\Controllers\Admin\MallController',"diffRangeSave"]);
            Route::post("recordByHandle",['App\Http\Controllers\Admin\MallController',"recordByHandle"]);
        });

        Route::prefix('finance')->group(function () {
            Route::get("mtLogs",['App\Http\Controllers\Admin\FinanceLogController',"mtLogs"]);
            Route::get("bankLogs",['App\Http\Controllers\Admin\FinanceLogController',"bankLogs"]);
        });

        Route::prefix('system')->group(function () {
            Route::get("accounts",['App\Http\Controllers\Admin\SystemController',"accounts"]);
        });

        Route::prefix('counts')->group(function () {
            Route::prefix('backMoney')->group(function () {
                Route::get("capital",['App\Http\Controllers\Admin\BackMoneyCountController',"capital"]);
                Route::get("pageItems",['App\Http\Controllers\Admin\BackMoneyCountController',"pageItems"]);
            });
        });
    });
});


Route::prefix('account')->group(function () {
    Route::post("meituan",['App\Http\Controllers\AccountController',"meituan"]);
});
